﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Globalization;
using System.Data;

public partial class Customerallinfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected override void InitializeCulture()
    {
        if (Session["CurrentCulture"] != null)
        {
            string lang = Session["CurrentCulture"].ToString();
            if (lang != null && lang != "")
            {
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang);


            }
        }

    }
     protected void display_Click(object sender, EventArgs e)
    {
        detail.Visible = true;
        LinkButton lk = (LinkButton)sender;
        string[] args = lk.CommandArgument.Split(',');

        DataSet ds=DB.Customerallinfo2(currentsubs.SelectedValue,"0");

        ds.Relations.Add("myrelation", ds.Tables["getCompSubInfo"].Columns["mysub"], ds.Tables["getstats2"].Columns["company_product_id"]);
        parentRepeater.DataSource = ds;
        parentRepeater.DataBind();
       
    }
     protected void parentRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
     {
         if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
         {

             GridView gr = (GridView)e.Item.FindControl("GridView1");
             gr.DataSource = ((DataRowView)e.Item.DataItem).Row.GetChildRows("myrelation");
             gr.DataBind();


         }
     }


     protected void LinkButton1_Click(object sender, EventArgs e)
     {
         Response.Redirect("~/reps2.aspx?rep=" + "customerallsubs" + "&id=" +currentsubs.SelectedValue + "&sid=0");
     }

     protected void currentsubs_SelectedIndexChanged(object sender, EventArgs e)
     {
         detail.Visible = false;
     }
}
